package org.example._00_base;

/**
 * 变量及其作用域
 */
public class _04_VariableTest {

    private static String str = "eddy";//类变量
    private int x;//实例变量,给初始化值

    private final int z = 22;

    public void add(){
//        int i;
//        int j = i+5 ; // 编译出错，变量i还未被初始化
//        System.out.println(j);

        int y = 1;//局部变量需要赋值
        int j = x + y;
        System.out.println(j);

//        z = z+ 1; //编译不通过，不允许修改常量的值

    }

    public static void main(String[] args) {
        _04_VariableTest variableTest = new _04_VariableTest();
        variableTest.add();
    }


}
